<template>
    <div style="height: 100vh;position: relative">
        <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
            <van-swipe-item class="swiperimg1"></van-swipe-item>
            <van-swipe-item class="swiperimg2"></van-swipe-item>
            <van-swipe-item class="swiperimg3"></van-swipe-item>
            <van-swipe-item class="swiperimg4"></van-swipe-item>
        </van-swipe>
        <div class="swiperbtn">
            <van-button type="default" @click="go" class="now">立即体验</van-button>
        </div>
    </div>
</template>

<script>
    import {getinformain} from "../api/api";
    import {Toast} from "vant";

    export default {
        name: "Newpage",
        data() {
            return {
            };
        },
        methods:{
            go(){
                const goToast = Toast.loading({
                    duration:0,
                    message: '加载中...',
                    forbidClick: true,
                    loadingType: 'spinner',
                });
                getinformain().then(res => {
                    console.log(res)
                    if(res.data.code == 0){
                        goToast.clear()
                        Toast.success("加载成功");
                        this.$router.push('/index')
                    }else{
                        goToast.clear()
                        Toast.success("加载成功");
                        this.$router.push('/pwdlogin')
                    }

                })
            }
        }
    }
</script>

<style scoped>
    .my-swipe .van-swipe-item {
        color: #fff;
        font-size: 20px;
        height: 100vh;
        text-align: center;
        background-color: #39a9ed;
    }
    .swiperimg1 {
        background-image: url("../assets/img/1.jpg");
        background-repeat: no-repeat;
        background-size: 100% 100%;
    }
    .swiperimg2 {
        background-image: url("../assets/img/2.jpg");
        background-repeat: no-repeat;
        background-size: 100% 100%;
    }
    .swiperimg3 {
        background-image: url("../assets/img/3.jpg");
        background-repeat: no-repeat;
        background-size: 100% 100%;
    }
    .swiperimg4 {
        background-image: url("../assets/img/4.jpeg");
        background-repeat: no-repeat;
        background-size: 100% 100%;
    }
    .swiperbtn {
        text-align: center;
        width: 26%;
        position: absolute;
        left:37%;
        bottom: 10%;
        opacity: 0.9;
    }
    /deep/.van-button--default {
        border-radius: 30px;
    }
</style>